<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Count the number of entries in a search</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ldap-control-paged-result.html">ldap_control_paged_result</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ldap-delete.html">ldap_delete</a></div>
 <div class="up"><a href="ref.ldap.html">LDAP 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ldap-count-entries" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ldap_count_entries</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">ldap_count_entries</span> &mdash; <span class="dc-title">Count the number of entries in a search</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ldap-count-entries-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>ldap_count_entries</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
   , <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result_identifier</code></span>
   )</div>

  <p class="para rdfs-comment">
   Returns the number of entries stored in the result of previous search
   operations.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ldap-count-entries-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">link_identifier</code></em></dt>

     <dd>

      <p class="para">
       An LDAP link identifier, returned by <span class="function"><a href="function.ldap-connect.html" class="function">ldap_connect()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">result_identifier</code></em></dt>

     <dd>

      <p class="para">
       The internal LDAP result.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ldap-count-entries-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns number of entries in the result or <strong><code>FALSE</code></strong> on error.
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-function.ldap-count-entries-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="ldap-count-entries.example.basic">
    <p><strong>Example #1 <span class="function"><strong>ldap-count-entries()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     Retrieve number of entries in the result.
    </p></div>
    <div class="example-contents">
     <div class="phpcode"><code><span style="color: #000000">
//&nbsp;$ds&nbsp;is&nbsp;a&nbsp;valid&nbsp;link&nbsp;identifier&nbsp;(see&nbsp;ldap_connect)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$dn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;'ou=example,dc=org';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$filter&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;'(|(sn=Doe*)(givenname=John*))';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$justthese&nbsp;=&nbsp;array('ou',&nbsp;'sn',&nbsp;'givenname',&nbsp;'mail');<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sr&nbsp;=&nbsp;ldap_search($ds,&nbsp;$dn,&nbsp;$filter,&nbsp;$justthese);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var_dump(ldap_count_entries($ds,&nbsp;$sr));</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
     <div class="cdata"><pre>
     int(1)
     </pre></div>
    </div>
   </div>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ldap-control-paged-result.html">ldap_control_paged_result</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ldap-delete.html">ldap_delete</a></div>
 <div class="up"><a href="ref.ldap.html">LDAP 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
